package cn.lanqiao.bigDate.service.data.impl;

import cn.lanqiao.bigDate.entity.data.DataBookOrder;
import cn.lanqiao.bigDate.mapper.data.DataBestPbhouseMapper;
import cn.lanqiao.bigDate.service.data.DataBestPbhouseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 第二版出版社排行
 */
@Service
public class DataBestPbhouseServiceImpl implements DataBestPbhouseService {
    @Resource
    private DataBestPbhouseMapper dataBestPbhouseMapper;
    @Override
    public List<Map<String, String>> findBestPbhouse() {
        QueryWrapper<DataBookOrder> wrapper = new QueryWrapper<>();
        Date yearMonth=new Date();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM");
        wrapper.like("date",sdf.format(yearMonth));
        String date = sdf.format(yearMonth);

        return dataBestPbhouseMapper.findBestPbhouse(date);
    }
}

